<?php

declare(strict_types=1);

namespace App\Validations;

/**
 * Define las reglas de validación de los usuarios.
 */
class UserValidation extends BaseValidation
{
    public function getAllRules(): array
    {
        return [
            'id' => ['guidv4'],
            'role_id' => ['guidv4'],
            'username' => ['alpha_numeric_dash', 'max_len' => 64],
            'email' => ['valid_email', 'max_len' => 128],
            'password' => ['regex' => '/^\S+$/', 'between_len' => [8, 32]],
            'confirm_password' => ['equalsfield' => 'password'],
        ];
    }

    public function getAllFilters(): array
    {
        return [
            'email' => ['lower_case'],
        ];
    }
}
